package com.yanfei.zero.domain.order.model;

import java.io.Serializable;
import java.util.Date;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.AccessMode;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
@Entity
@Table(name="yf_order_detail")
@Schema(description = "订单明细")  
public  class OrderItem implements Serializable { 
    public OrderItem() {  
    } 
	@Id
	@Schema(name = "ID", example = "1001")  
	private String orderDetailId;  
	@Schema(name = "订单ID", example = "1001")  
    @ManyToOne  
    @JoinColumn(name = "orderId") 
	private OrderPO orderPO;  
	
	@Schema(name = "产品ID", example = "1001")  
    private String productId;  
    @NotBlank(message = "商品名称不能为空")  
    @Schema(name = "商品名称", example = "iPhone 14 Pro")  
    private String productName;  
    @NotNull(message = "商品数量不能为空")  
    @Positive(message = "商品数量必须为正数")  
    @Schema(name = "商品数量", example = "2")  
    private Integer quantity; 
    private Double price;  
    @Schema(name = "创建时间", example = "2023-10-27T10:00:00Z", accessMode = AccessMode.READ_ONLY)  
    private Date createTime=new Date(); 
} 